package org.sport.model.entityModel;

import javax.persistence.*;

/**
 * Created by Allen on 2017/9/29.
 */
@Entity
@Table(name = "grouplinkuser", schema = "sportinfo", catalog = "")
public class GrouplinkuserEntity {
    private int id;
    private GrouptableEntity grouptableByGroupId;
    private UsertableEntity usertableByUserId;

    @Id
    @Column(name = "_id", nullable = false)
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        GrouplinkuserEntity that = (GrouplinkuserEntity) o;

        if (id != that.id) return false;

        return true;
    }

    @Override
    public int hashCode() {
        return id;
    }

    @ManyToOne
    @JoinColumn(name = "groupId", referencedColumnName = "_id")
    public GrouptableEntity getGrouptableByGroupId() {
        return grouptableByGroupId;
    }

    public void setGrouptableByGroupId(GrouptableEntity grouptableByGroupId) {
        this.grouptableByGroupId = grouptableByGroupId;
    }

    @ManyToOne
    @JoinColumn(name = "userId", referencedColumnName = "_id")
    public UsertableEntity getUsertableByUserId() {
        return usertableByUserId;
    }

    public void setUsertableByUserId(UsertableEntity usertableByUserId) {
        this.usertableByUserId = usertableByUserId;
    }
}
